#!/bin/bash

# MCP Tool Debugger 启动脚本

echo "🚀 Starting MCP Tool Debugger..."
echo ""

# 检查 Flutter 是否安装
if ! command -v flutter &> /dev/null
then
    echo "❌ Flutter 未安装或不在 PATH 中"
    echo "请访问 https://flutter.dev/docs/get-started/install 安装 Flutter"
    exit 1
fi

# 检查 Flutter 版本
echo "📦 检查 Flutter 环境..."
flutter --version
echo ""

# 获取依赖
echo "📥 获取依赖..."
flutter pub get
echo ""

# 检测操作系统并运行
OS="$(uname -s)"
case "${OS}" in
    Darwin*)
        echo "🍎 检测到 macOS 系统，启动应用..."
        flutter run -d macos
        ;;
    Linux*)
        echo "🐧 检测到 Linux 系统，启动应用..."
        flutter run -d linux
        ;;
    MINGW*|MSYS*|CYGWIN*)
        echo "🪟 检测到 Windows 系统，启动应用..."
        flutter run -d windows
        ;;
    *)
        echo "❓ 未知操作系统: ${OS}"
        echo "请手动运行: flutter run"
        exit 1
        ;;
esac
